All Functions Used on PO11Q

as.numeric

{base}

Coerce a vector to numeric

mutate

{dplyr}

Modify/create a column in a data frame

mean

{base}

Get mean of a vector

write_dta

NA

read.csv

{utils}

Read a csv file to data frame. Specify stringsAsFactors = FALSE to keep all string columns as characters

summarize

NA

with

{base}

evaluate expression in the context of a data frame

write.csv

{utils}

write a csv file to a data frame

labs

{GGPLOT2}

Customise labels in GGPLOT2

table

{base}

Obtain frequency table of a variable/cross-tabulation of two variables

ungroup

{dplyr}

Resolve grouping created with “group_by”

sample_n

{dplyr}

Sample a number of observations from a data frame

set.seed

{base}

Initialise a pseudorandom number generator.

hist

{graphics}

Plot a simple histogram

read_dta

{haven}

Read a .dta file (Stata data)

ifelse

{base}

Return a or b depending on the value of test

recode

{dplyr}

Recode a variable

select

{dplyr}

Select columns from a tibble/data frame

read_excel

{readxl}

Read an Excel file

is.na

{base}

Check if a value is NA/elements of vector are NA

head

{utils}

Show first 5 rows of a data frame

min

{base}

Get minimum of a vector

sum

{base}

Get sum of numeric values or a vector

group_by

{dplyr}

Group tibble/data.frame by a factor variable. All further tidyverse operations are performed group-wise

n

{dplyr}

The number of observations in the current group.

geom_segment

{GGPLOT2}

Generates a line segment or curve

filter

{dplyr}

Filter out rows of a data frame according to logical vector

slice

{dplyr}

Subset rows using their positions

complete.cases

{stats}

Find Complete Cases

aes

{GGPLOT2}

Construct aesthetic mapping of a ggplot graph

geom_bar

{GGPLOT2}

Generates a bar chart

element_text

{GGPLOT2}

Customise text in GGPLOT2

cut

{base}

Convert Numeric to Factor

separate

{dplyr}

Separate a character column into multiple columns

library

{base}

Load an R package

names

{base}

Retrieve names of a list/vector

ecdf

{stats}

Compute an empirical cumulative distribution function

str

{utils}

Get the structure of an R object

data.frame

{base}

Create a data.frame from vectors

summarise

{dplyr}

collapse the dataset to a summary statistic. Usually used with group_by()

median

{stats}

Get median of a vector

ggplot

{GGPLOT2}

Create a ggplot graph

stat_ecdf

{GGPLOT2}

Compute empirical cumulative distribution

range

{base}

Return range of values

as.character

{base}

Coerce a vector to character

t.test

{stats}

Performs one and two sample t-tests on vectors of data.

setwd

{base}

Set Working Directory

theme_classic

{GGPLOT2}

A minimalistic theme with no gridlines

summary

{base}

Obtain summary statistics or detailed regression output

desc

{dplyr}

Arrange in descending order

prop.test

{stats}

Test of Equal or Given Proportions

sqrt

{stats}

Square root

ylab

{GGPLOT2}

Label the y axis (ggplot)

ordered

{dplyr}

Create an ordered factor

boxplot

{graphics}

Plot a simple box plot

geom_histogram

{GGPLOT2}

Generates a histogram

save

{base}

Writes an external representation of R objects to the specified file.

arrange

{dplyr}

Sort values of data frame according to a variable/combination of varaibles

spread

{tidyr}

Spread a key-value pair across multiple columns

sd

{stats}

Get standard deviation of a vector

max

{base}

Get maximum of a vector

c

{base}

Combine values/vectors into a vector

factor

{base}

Create a factor

seq

{base}

Create a sequence

theme

{GGPLOT2}

Set theme for GGPLOT2

levels

{base}

Get levels of a factor

var

{stats}

Calculate variance

scale_x_continuous

{GGPLOT2}

Customise continuous x axis

scale_y_continuous

{GGPLOT2}

Customise continuous y axis

The end!